// OUTDOOR SECTION SCRIPT
//    Section: X = 0, Y = 0: Poulan Valley

beginoutdoorscript;

variables;

int choice;

body;

beginstate INIT_STATE;
// This state called whenever this section is loaded into memory.
break;

beginstate START_STATE;
// Starting state of the section, called every turn the party 
// stands inside this section until you change the state.

//	if (get_flag(4,28) == 1)
//		set_terrain(24,25,329);

//	if (get_flag(103,2) == 1)
//		set_terrain(4,2,405);

	if (get_flag(109,2) == 1)
		set_terrain(26,9,56);

break;

beginstate 11;//watch tower
	if (get_flag(5,28) == 0) {
		reset_dialog_preset_options(0);
		add_dialog_str(0,"There's a watchtower here. A few guards keep vigil, while a few more rest or busy themselves with other activities.",0);
		if (get_flag(200,5) == 0)
			add_dialog_str(1,"One of those keeping watch reports to you that nothing has reached beyond the bridge. Yet.",0);
		choice = run_dialog(0);
		if (choice == 1)
			set_flag(5,28,1);
	}
break;

beginstate 12;//damaged farm 1
	if (get_flag(0,28) == 0) {
		reset_dialog_preset_options(0);
		add_dialog_str(0,"This farm has taken a lot of damage. It was attacked, and the field was burned. However, there are no bodies or signs of struggle. It appears that the owners escaped before the attack came.",0);
		choice = run_dialog(0);
		if (choice == 1)
			set_flag(0,28,1);
	}
break;

beginstate 13;//damaged farm 2
	if (get_flag(1,28) == 0) {
		reset_dialog_preset_options(0);
		add_dialog_str(0,"This farm has taken a lot of damage. It was attacked, and the field was burned. However, there are no bodies or signs of struggle. It appears that the owners escaped before the attack came.",0);
		choice = run_dialog(0);
		if (choice == 1)
			set_flag(1,28,1);
	}
break;

beginstate 14;//damaged farms 3
	if (get_flag(2,28) == 0) {
		reset_dialog_preset_options(0);
		add_dialog_str(0,"This farm has been utterly decimated. There are no bodies, but there is blood on the walls and floor. It looks like the former owners didn't make it out.",0);
		choice = run_dialog(0);
		if (choice == 1)
			set_flag(2,28,1);
	}
break;

beginstate 15;
	reset_dialog_preset_options(0);
	add_dialog_str(0,"You stumble across a party of reptiles near Poulan. They look as though they're going to attack soon. No doubt they were sent by the dragon.",0);
	add_dialog_str(1,"Fortunately, you've arrived before anything has happened. Unfortunately, they've seen you and don't want you to get away and tell anyone about them.",0);
		choice = run_dialog(0);
		if (choice == 1)
			end();
break;

beginstate 16;
	reset_dialog_preset_options(0);
	add_dialog_str(0,"The battle is over, and you get an opportunity to examine the corpses. Some of these creatures look almost like Slithzerikai, except for their deep red color. Most peculiar.",0);
		choice = run_dialog(0);
		if (choice == 1)
			end();
break;

beginstate 17;
	outdoor_enc_result(1);
	if (get_flag(3,28) == 0) {
		reset_dialog_preset_options(0);
		add_dialog_str(0,"There are guards standing at the end of this bridge. When they see that you're not lizards, they let you pass.",0);
		choice = run_dialog(0);
		if (choice == 1)
			set_flag(3,28,1);
	}
break;

beginstate 18;
	reset_dialog();
	add_dialog_str(0,"A group of soldiers is fighting a small army of lizards. It looks grim. They probably won't survive.",0);
	add_dialog_str(1,"You are contemplating whether or not to help them, when you notice that the battle is quickly moving towards you. Suddenly the decision of whether or not to enter the battle is no longer yours.",0);
	add_dialog_choice(0,"Oh, great.");
	choice = run_dialog(0);
	if (choice ==1)
		end();
break;

beginstate 19;
	reset_dialog_preset_options(0);
	add_dialog_str(0,"The battle is over, and the surviving soldiers start tending to their wounded. You catch a glimpse of a pair of soldiers dragging off a surviving lizard. One that is almost humanoid in form.",0);
	add_dialog_str(1,"That's all you see before the leader of the soldiers approaches you. He introduces himself as Captain Terronez. He requests that you meet him at the war camp.",0);
	add_dialog_str(2,"He then proceeds to give you directions. He tells you to travel to the southwest until you reach the forest and the river, then turn northward. With that, he thanks you and bids you farewell.",0);
	choice = run_dialog(1);
	if (choice == 1) {
		set_town_visibility(2,1);
		set_terrain(24,25,329);
		set_flag(4,28,1);
		toggle_quest(1,0);
	}
break;